package com.itheima.homework.Date类;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) throws ParseException {
        Date date=new Date();
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入第一个生日:");
        String bir1 = sc.next();
        SimpleDateFormat sdf=new SimpleDateFormat("YYYY年MM月dd日");
        Date parse = sdf.parse(bir1);
        long time1 = parse.getTime();
        if(time1>date.getTime()){
            System.out.println("生日日期必须早于当前日期");
            return;
        }
        System.out.println("请输入第二个生日:");
        String bir2 = sc.next();
        Date parse1 = sdf.parse(bir2);
        long time2 = parse1.getTime();
        if(time2>date.getTime()){
            System.out.println("生日日期必须早于当前日期");
            return;
        }
        if(time1-time2<0){
            System.out.println("第一个生日大于第二个生日");
        }else {
            System.out.println("第一个生日小于第二个生日");
        }
    }
}
